#!/usr/bin/env python

import sys

def main():
    cur_key = None
    for line in sys.stdin:
        [ key, val ] = line.split(None, 1)
        if cur_key != key:
            if cur_key is not None:
                sys.stdout.write("%s\t%d\n" % (cur_key, cur_count))
            cur_key = key
            cur_count = 0
        cur_count += int(val)
    if cur_key is not None:
        sys.stdout.write("%s\t%d\n" % (cur_key, cur_count))
        
sys.exit(main())
